<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/react.development.js"></script>
    <script src="js/react-dom.development.js"></script>
    <script src="js/babel.min.js"></script>
</head>
<body>
<div id="root"></div>


<script type="text/babel">
    // let aList = ['h', 'j', 'k', 'l'];
    //
    // let el = aList.map(function (item, index) {
    //     return <li key={index}>{item}</li>;
    // })
    //
    // ReactDOM.render(<ul>{el}</ul>, document.getElementById('root'));


    class MyFrom extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                iNum: ""
            }
        }

        changeRun(ev) {
            // this.setState({
            //     iNum: ev.target.value
            // })

            let vm = ev.target.value;
            this.setState(
                function (pro) {
                    pro.iNum = vm;
                    return pro;
                }
            )
        }

        render() {
            return (
                <div>
                    <p>{this.state.iNum}</p>
                    <input type="text" onChange={this.changeRun.bind(this)}/>
                </div>
            );
        }
    }


    ReactDOM.render(<MyFrom/>, document.getElementById('root'));


</script>
</body>
</html>